package com.ruoyi.web.controller.admin.requirement;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.RequirementTemplateItem;
import com.ruoyi.system.service.IRequirementTemplateItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 需求模板管理Controller
 * 
 * @author ruoyi
 */
@Slf4j
@RestController
@RequestMapping("/requirement/template")
@Api(tags = "需求模板管理")
public class RequirementTemplateController extends BaseController {

    @Autowired
    private IRequirementTemplateItemService requirementTemplateItemService;

    /**
     * 获取已发布的模板项（树/扁平）
     */
    @GetMapping("/publishedItems")
    @ApiOperation("获取发布状态的模板项")
    public AjaxResult getPublishedItems() {
        List<RequirementTemplateItem> items = requirementTemplateItemService.listPublishedItems();
        return AjaxResult.success(items);
    }
}
